//
//  CLUserInfo.m
//  CareLink
//
//  Created by clinging on 16/8/19.
//  Copyright © 2016年 Seven Team. All rights reserved.
//

#import "CLUserInfo.h"

@implementation CLUserInfo

+(instancetype)AccountStatusWithDict:(NSDictionary *)dict
{
    CLUserInfo *account=[[self alloc]init];
    account.userIdentifier=dict[@"userIdentifier"];
    account.userName=dict[@"userName"];
    account.phoneNumber=dict[@"iconImage"];
    account.height=dict[@"height"];
    account.weight=dict[@"weight"];
    account.province=dict[@"province"];
    
    
    
    return account;
}

/**
 *  当一个对象要归档进沙盒的时候就会调用  归档
 *  目的，在这个方法中说明这个对象的哪些属性写进沙盒
 *  @param encoder
 */
-(void)encodeWithCoder:(NSCoder *)encoder
{
    [encoder encodeObject:self.userIdentifier forKey:@"userIdentifier"];
    [encoder encodeObject:self.userName forKey:@"userName"];
    [encoder encodeObject:self.iconImage forKey:@"iconImage"];
    [encoder encodeObject:self.height forKey:@"height"];
    [encoder encodeObject:self.weight forKey:@"weight"];
    [encoder encodeObject:self.province forKey:@"province"];
}

/**
 *  反归档 的时候会调用这个方法  解档
 *  目的：在这个方法中说明这个对象的哪些属性从沙河中解析出来
 从沙盒中解析对象 反归档会调用这个方法 需要解析哪些属性
 */
-(instancetype)initWithCoder:(NSCoder *)decoder
{
    if (self=[super init]) {
        self.userIdentifier=[decoder decodeObjectForKey:@"userIdentifier"];
        self.userName=[decoder decodeObjectForKey:@"userName"];
        self.iconImage=[decoder decodeObjectForKey:@"iconImage"];
        self.height=[decoder decodeObjectForKey:@"height"];
        self.weight=[decoder decodeObjectForKey:@"weight"];
        self.province=[decoder decodeObjectForKey:@"province"];
        
    }
    return self;
}


@end
